<div class="leftpanel">

    <div class="logopanel">
        <h1><span>[</span> 连连惠 <span>]</span></h1>
    </div><!-- logopanel -->

    <div class="leftpanelinner">

        <!-- This is only visible to small devices -->
        <div class="visible-xs hidden-sm hidden-md hidden-lg">
            <div class="media userlogged">
                <img alt="" src="../images/photos/loggeduser.png" class="media-object">
                <div class="media-body">
                    <h4>{{$ADMIN_REAL_NAME}}</h4>
                </div>
            </div>

            <h5 class="sidebartitle actitle">账号</h5>
            <ul class="nav nav-pills nav-stacked nav-bracket mb30">
                <!--<li><a href="profile.html"><i class="fa fa-user"></i> <span>Profile</span></a></li>-->
                <!--<li><a href=""><i class="fa fa-cog"></i> <span>Account Settings</span></a></li>-->
                <!--<li><a href=""><i class="fa fa-question-circle"></i> <span>Help</span></a></li>-->
                <li><a href="/login/logout"><i class="fa fa-sign-out"></i> <span>退出</span></a></li>
            </ul>
        </div>

        <ul class="nav nav-pills nav-stacked nav-bracket">
            <li class="active"><a href="javascript:void 0;" data-href="/index/index"><i class="fa fa-home"></i> <span>首页</span></a></li>
            {{foreach $menu_list as $value }}
            <li class="nav-parent"><a href="{{$value.link}}"><i class="fa fa-edit"></i> <span>{{$value.name}}</span></a>
                <ul class="children">
                    {{if !empty($value._child) }}
                    {{foreach $value._child as  $val }}
                    <li><a href="{{$val.link}}" data-href="{{$val.link}}"><i class="fa fa-caret-right"></i><span>{{$val.name}}</span></a></li>
                    {{/foreach}}
                    {{/if}}
                </ul>
            </li>
            {{/foreach}}

        </ul>
    </div><!-- leftpanelinner -->
</div><!-- leftpanel -->
<script>
    function GetUrlRelativePath()
    {
        var url = document.location.toString();
        var arrUrl = url.split("//");

        var start = arrUrl[1].indexOf("/");
        var relUrl = arrUrl[1].substring(start);//stop省略，截取从start开始到结尾的所有字符

        if(relUrl.indexOf("?") != -1){
            relUrl = relUrl.split("?")[0];
        }
        return relUrl;
    }
    document.body.onload = function () {
        $(".leftpanelinner .nav li").each(function () {
           if($(this).hasClass("active"))
           {
               $(this).removeClass("active").removeClass("nav-active");
           }
        });
       var obj = $(".leftpanelinner .nav a[href='"+GetUrlRelativePath()+"']");
       if(obj.length>0)
       {
           obj.parent().parent().show();
           obj.parent().addClass("active");
           obj.parents(".nav-parent").addClass("active").addClass("nav-active");
       }
    };

</script>